<?php

include('../config.php');

$id = $_GET['id'];
$name = $_GET['name'];
$price = $_GET['price'];
$num = $_GET['num'];
$res1 = $res2 = $res3 = true;
if($name){
    $sql_name = "update shop set name ='$name' where id =$id";
}
if($price){
    $sql_price ="update shop set price = $price where id = $id";
}
if($num){
    $sql_num ="update shop set num = $num where id = $id";
}

if($sql_name){
    $res1 = mysql_query($sql_name);
}
if($sql_price){
    $res2 = mysql_query($sql_price);
}
if($sql_num){
    $res3 = mysql_query($sql_num);
}
if($res1&&$res2&&$res3){
    echo json_encode(array(
        "code" => 200,
        "body" => array(
            "msg" =>"编辑成功"
        )
        ));
}else{
    echo json_encode(array(
        "code" => 400,
        "body" => array(
            "msg" => "编辑失败,请稍后再次尝试"
        )
        ));
}

?>

